﻿// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_PROD_PRODUCT_MATERIAL_HISTORY
// * CreateDate    : 2011-11-8 13:50:56
// * Creater       : CodeSmith
// * LastChangeDate: 2011-11-8 13:50:56
// * LastChanger   : 2011-11-8 13:50:56
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using System.Data;

using ESOL.Common;
using ESOL.Common.Entity;

namespace ESOL.Business.Prod
{
    /// <summary>
    /// ProdProductMaterialHistory
    /// </summary>
    public partial class ProdProductMaterialHistoryBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objProdProductMaterialHistoryEntity">Entity</param>
        /// <returns>Entity</returns>
        public static ProdProductMaterialHistoryEntity GetProdProductMaterialHistory(ProdProductMaterialHistoryEntity objProdProductMaterialHistoryEntity)
        {
            return DataAccess.SelectSingle<ProdProductMaterialHistoryEntity>(objProdProductMaterialHistoryEntity);
        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objProdProductMaterialHistoryEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertProdProductMaterialHistory(ProdProductMaterialHistoryEntity objProdProductMaterialHistoryEntity)
        {
            return DataAccess.Insert(objProdProductMaterialHistoryEntity);
        }

        public static bool InsertProdProductMaterialHistory(List<ProdProductMaterialHistoryEntity> objProdProductMaterialHistoryEntityList)
        {
            return DataAccess.Insert(objProdProductMaterialHistoryEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objProdProductMaterialHistoryEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateProdProductMaterialHistory(ProdProductMaterialHistoryEntity objProdProductMaterialHistoryEntity)
        {
            return DataAccess.Update(objProdProductMaterialHistoryEntity);
        }

        public static bool UpdateProdProductMaterialHistory(List<ProdProductMaterialHistoryEntity> objProdProductMaterialHistoryEntityList)
        {
            return DataAccess.Update<ProdProductMaterialHistoryEntity>(objProdProductMaterialHistoryEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objProdProductMaterialHistoryEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteProdProductMaterialHistory(ProdProductMaterialHistoryEntity objProdProductMaterialHistoryEntity)
        {
            return DataAccess.Delete(objProdProductMaterialHistoryEntity);
        }

        public static bool DeleteProdProductMaterialHistory(List<ProdProductMaterialHistoryEntity> objProdProductMaterialHistoryEntityList)
        {
            return DataAccess.Delete<ProdProductMaterialHistoryEntity>(objProdProductMaterialHistoryEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetProdProductMaterialHistoryAll()
        {
            return DataAccess.SelectAllDataSet<ProdProductMaterialHistoryEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<ProdProductMaterialHistoryEntity> GetProdProductMaterialHistoryAllList()
        {
            return DataAccess.SelectAll<ProdProductMaterialHistoryEntity>();
        }
        #endregion

        #region Functions
        public static ProdProductMaterialHistoryEntity GetProdProductMaterialHistoryByID(string ID)
        {
            if (string.IsNullOrEmpty(ID))
                return null;
            ProdProductMaterialHistoryEntity entity=new ProdProductMaterialHistoryEntity();
            entity.ProductId=ID;
            return DataAccess.SelectSingle<ProdProductMaterialHistoryEntity>(entity);
        }

        public static DataTable GetDtProductMaterialHistoryByID(string ID)
        {
            if (string.IsNullOrEmpty(ID))
                return null;
            string Sql = @"SELECT * FROM PROD_PRODUCT_MATERIAL_HISTORY WHERE PRODUCT_ID='"+ID+"' ";
            DataSet ds = DataAccess.SelectDataSet(Sql);
            if (ds != null && ds.Tables[0] != null)
                return ds.Tables[0];
            else return null;
        }
        #endregion
    }


}

